package com.indexingsystem.system.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.indexingsystem.boss.admin.mapper.LogClustersMapper;
import com.indexingsystem.boss.common.PagedResult;
import com.indexingsystem.boss.entity.LogClusters;
import com.indexingsystem.boss.utils.BeanUtils;
import com.indexingsystem.system.service.ILogClustersService;

@Service
public class LogClustersServiceImpl implements ILogClustersService{

	@Resource
	private LogClustersMapper logClusterMapper;
	@Override
	public int deleteByPrimaryKey(String logClusterId) {
		return logClusterMapper.deleteByPrimaryKey(logClusterId);
	}

	@Override
	public int insertSelective(LogClusters record) {
		return logClusterMapper.insertSelective(record);
	}

	@Override
	public LogClusters selectByPrimaryKey(String logClusterId) {
		return logClusterMapper.selectByPrimaryKey(logClusterId);
	}

	@Override
	public int updateByPrimaryKeySelective(LogClusters record) {
		return logClusterMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public PagedResult<LogClusters> selectLogClustersList(Integer pageNo, Integer pageSize) {
		pageNo = pageNo == null?1:pageNo;
		pageSize = pageSize == null?10:pageSize;
		//startPage是告诉拦截器说我要开始分页了。分页参数是这两个。
		PageHelper.startPage(pageNo,pageSize);  
		return BeanUtils.toPagedResult(logClusterMapper.selectLogClustersList());
	}

	@Override
	public int deleteLogClustersByIdBatch(List<String> logClusterId) {
		return logClusterMapper.deleteLogClustersByIdBatch(logClusterId);
	}
}